/**
 * 圆
 */
class Circle extends AreaPlotBase{

  constructor(points) {
    super(points);
  }


  get_minPointCount() {
    return 2;
  }

  create() {
    const n = this.points.length;
    if (n >= 2 && this.points[n - 1] != this.points[n - 2])
    {
      const center = this.points[0];
      const endPnt = this.points[1];
      const radius= super.distance(center, endPnt);

      let sin=0;
      let cos=0;
      let x=0;
      let y=0;
      const pnts = [];
      for (let i=0; i < 100; i++)
      {
        sin=Math.sin(Math.PI * 2 * i / 100);
        cos=Math.cos(Math.PI * 2 * i / 100);
        x=center.X + radius * sin;
        y=center.Y + radius * cos;
        pnts.push([x,y]);
      }

      const pc3 = [];
      for (let j = 0; j < pnts.length; j++)
      {
        pc3.push(pnts[j]);
      }
      if (pnts.length > 0)
      {
        pc3.push(pnts[0]);
      }
      //////***////////
      if (this.PartCount > 0)
      {
        this.RemovePart(0);
      }
      this.AddPart(pc3);
    }
  }

}
